<template>
	<view class="content">
		<u-navbar bgColor="#fff" :placeholder="true" :fixed="true" @leftClick="$back" title="dream约文" titleStyle="{'color': '#000'}">
			
		</u-navbar>
		<view class="main">
			<view class="youbg">
				<image :src="'/images/youbg.png' | formatImgUrl" class="youpic" mode=""></image>
				<view class="wenben">
					<view class="youleft" >
						<view class="yltop">
							<view class="yline"></view>
							<view class="yltitle">
								支付满减券
							</view>
							<view class="yitxt">
								有效期 {{$options.filters.parseTime(couponInfo.validity,'{y}-{m}-{d}') }}
							</view>
						</view>
						<view class="mantxt">
							{{couponInfo.coupon.price}}币<text>约稿红包</text>
						</view>
						<view class="shaotxt oneline">
							新用户约稿畅享好礼，满{{couponInfo.coupon.man_price}}减{{couponInfo.coupon.price}}币
						</view>
					</view>
					<view class="youtxt">
						{{couponInfo.status?'已使用':'待使用'}}
					</view>
				</view>
			</view>
		</view>
		<view class="manbox">
			<view class="manli">
				<view class="mantitle">
					满减优惠券
				</view>
				<view class="mantxt">
					满{{couponInfo.coupon.man_price}}减{{couponInfo.coupon.price}}币
				</view>
			</view>
			<view class="manli">
				<view class="mantitle">
					有效期
				</view>
				<view class="mantxt">
					有效期至 {{$options.filters.parseTime(couponInfo.validity,'{y}-{m}-{d}') }}
				</view>
			</view>
		</view>
		<view class="xuzhi">
			<view class="xutitle">
				优惠券使用规则说明：
			</view>
			<view class="xutxt">
				支付优惠券：<br>
				1.优惠券的使用期限为规定时间内，过期后不可使用。<br>
				2.每张优惠券只能使用一次。<br>
				3.优惠券不能兑现，不能与其他优惠券叠加使用。<br>
				4.如有疑问，请咨询客服。
			</view>
			
			<view class="xutxt">
				满减优惠券：<br>
				1.优惠券的使用期限为规定时间内，过期后不可使用。<br>
				2.每张优惠券只能使用一次。<br>
				3.优惠券不能兑现，不能与其他优惠券叠加使用。<br>
				4.如使用满减优惠券，需满足优惠券规定的消费金额后，才可使用。<br>
				5.如有疑问，请咨询客服。
			</view>
			<view class="xutitle">
				平台内所有优惠券，最终说明权归平台方所有
			</view>
			
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				id:'',
				couponInfo:{}
			}
		},
		onLoad(e) {
			if(e.id){
				this.id = e.id
				this.getInfo()
			}else{
				this.$common.errorToShow('参数异常')
			}
		},
		methods: {
			getInfo(){
				this.$api.default.request('user/getCouponInfo',{id:this.id}).then((res) => {
					if (res.code) {
						this.couponInfo = res.data
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: rgba(242, 245, 242, 1);
	}

	.content {
		.main{
			padding: 44rpx 30rpx 10rpx;
			.youbg {
				width: 690rpx;
				height: 238rpx;
				margin-bottom: 30rpx;
				position: relative;
				box-shadow: 0px 8rpx 20rpx 0px rgba(61, 61, 61, 0.15);
				.youpic {
					width: 100%;
					height: 238rpx;
				}
				.wenben {
					position: absolute;
					left: 0;
					top: 0;
					width: 100%;
					height: 238rpx;
					display: flex;
					align-items: flex-start;
					justify-content: space-between;
			
					.youleft {
						width: 608rpx;
						padding-left: 20rpx;
						flex-shrink: 0;
			
						.yltop {
							display: flex;
							align-items: center;
							justify-content: space-between;
							height: 68rpx;
			
							.yline {
								width: 4rpx;
								height: 28rpx;
								border-radius: 84px;
								opacity: 1;
								background: #45C4B0;
							}
			
							.yltitle {
								font-size: 28rpx;
								font-weight: 500;
								color: #3D3D3D;
								padding-left: 12rpx;
							}
							.yitxt{
								flex-grow: 1;
								font-size: 20rpx;
								font-weight: normal;
								text-align: right;
								letter-spacing: 0em;
								color: #999999;
								padding-right: 34rpx;
							}
						}
			
						.mantxt {
							padding: 20rpx 0 10rpx;
							font-size: 48rpx;
							color: #45C4B0;
			
							text {
								font-size: 48rpx;
								color: #3d3d3d;
							}
						}
			
						.shaotxt {
							font-size: 28rpx;
							font-weight: 300;
							color: #999999;
						}
					}
			
					.youtxt {
						font-size: 28rpx;
						font-weight: bold;
						color: #FFFFFF;
						width: 60rpx;
						text-align: center;
						line-height: 40rpx;
						letter-spacing: 5rpx;
						padding-top: 60rpx;
					}
				}
			}
		}
		.manbox{
			background-color: #FFFFFF;
			margin-bottom: 0rpx;
			padding: 0 40rpx;
			.manli{
				display: flex;
				align-items: center;
				height: 120rpx;
				justify-content: space-between;
				border-bottom: 1px solid rgba(153, 153, 153, 0.1);
				.mantitle{
					font-size: 28rpx;
					font-weight: bold;
					letter-spacing: 0em;
					color: #3D3D3D;
				}
				.mantxt{
					font-size: 28rpx;
					text-align: right;
					letter-spacing: 0em;
					color: #999999;
				}
			}
		}
		.xuzhi{
			padding: 0 40rpx;
			.xutitle{
				font-size: 20rpx;
				font-weight: normal;
				letter-spacing: 0em;
				color: #999999;
				line-height: 28rpx;
				padding: 15rpx 0;
			}
			.xutxt{
				font-size: 20rpx;
				font-weight: normal;
				letter-spacing: 0em;
				color: #999999;
				padding: 15rpx 0;
				line-height: 28rpx;
			}
		}
	}
</style>